#pragma once
#include "hgefontmanager.h"
#include "hgefontex.h"
#include "ResourceMng.h"
#include "XProperty.h"

class b2Render;
class CGameLevel;
class PropertyTestBase : public XObject
{
	//DECLARE_RUNTIMECLASS( PropertyTestBase )
	//DECLARE_PROPERTYLIST( PropertyTestBase )
public:
	int a[3];
	virtual void dosome() = 0;
	char b[32];

	xgc_string c;
};

class PropertyTest : public PropertyTestBase
{
	//DECLARE_RUNTIMECLASS( PropertyTest )
	//DECLARE_PROPERTYLIST( PropertyTest )
public:
	int d;
	char e[10];
	virtual void dosome(){}
	xgc_string f;
	XVariant attribute[10];
};

class CGameClient
{
	friend struct CreateStatic< CGameClient >;
	friend static bool RenderFunc();
	friend static bool FrameFunc();
	
private:
	CGameClient(void);
	virtual ~CGameClient(void);

public:
	bool Initialize();
	void Run();
	void UnInitialize();

	HGE* operator->(){ return hge; }
	HGE* getEngine(){ return hge; }

	bool IsDebug()const{ return mDebug; }
	bool IsEdit()const{ return mEdit; }
protected:
	bool UpdateLogic( xgc_float32 fTime, xgc_float32 fDelta );

private:
	bool RenderFunc();
	bool FrameFunc();

private:
	HGE			*hge;
	b2Render	*mRender;
	xgc_float32	mZoom;
	fPoint		ptOffset;

	fPoint		ptMonseDown;
	fPoint		ptMouseUp;

	bool		mDebug;
	bool		mEdit;

	xgc_string	strName;
	CGameLevel*		mLevel;
	hgeAnimation*	mCursor;

	CResourceMng	mResourceMng;

	char name[32];
};

typedef SingletonHolder< CGameClient, CreateStatic > Application;